import React from "react";
import { routes } from "../../router";
import { NavLink } from "react-router-dom";

function Menu(Com: any) {
  function Hoc(props: any) {
    return (
      <div>
        <Com {...props}></Com>
        <ul className="ul">
          {routes
            .filter((item) => !item.hidden)
            .map((item) => (
              <li key={item.path}>
                <NavLink to={item.path}>
                  <div>{item.icon ? <item.icon fontSize={22} /> : ""}</div>
                  {item.title}
                </NavLink>
              </li>
            ))}
        </ul>
        ;
      </div>
    );
  }
  return Hoc;
}

export default Menu;
